bitkeeper revision 1.879.1.2 (408f99e7sN48_I90Di8Eqaodd_1KjQ)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Wed, 28 Apr 2004 11:47:51 +0000 (11:47 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Wed, 28 Apr 2004 11:47:51 +0000 (11:47 +0000)
A few fixes to new I/O world.

tools/xend/lib/domain_controller.h
tools/xend/lib/main.py
xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/backend/control.c
xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/frontend/main.c

index eec8402e5fa5c504d60139d51879f9db23a10ef1..d9ea7d616081871d467959ea951f6def9f87f2bd 100644 (file)
@@ -258,13 +258,13 @@ typedef struct {
 } blkif_be_vbd_shrink_t; 
 
 /*
- * CMSG_BLKIF_FE_DRIVER_STATUS_CHANGED:
+ * CMSG_BLKIF_BE_DRIVER_STATUS_CHANGED:
  *  Notify the domain controller that the back-end driver is DOWN or UP.
  *  If the driver goes DOWN while interfaces are still UP, the domain
  *  will automatically send DOWN notifications.
  */
 typedef struct {
     unsigned int status; /* BLKIF_DRIVER_STATUS_??? */
-} blkif_be_driver_status_changed;
+} blkif_be_driver_status_changed_t;
 
 #endif /* __DOMAIN_CONTROLLER_H__ */
index 4dd26ca8c578e28ad712486beb9ad3ad3da62b5f..b870af55d1d3309347f0070faf37c8391e4535fa 100755 (executable)
@@ -46,11 +46,13 @@ def daemon_loop():
 
     # The DOM0 control interface is not set up via the management interface.
     # Note that console messages don't come our way (actually, only driver
-    # back-ends should use the DOM0 control interface). We therefore don't
-    # need to set up console structures.
-    xend.utils.port(0)
-    xend.main.notifier.bind(port.local_port)
-    xend.main.control_list[port.local_port] = (port, 0, 0, 0)
+    # back-ends should use the DOM0 control interface) -- the console
+    # structures are dummies.
+    dom0_port = xend.utils.port(0)
+    xend.main.notifier.bind(dom0_port.local_port)
+    xend.main.control_list[dom0_port.local_port] =          \
+      (dom0_port, xend.utils.buffer(), xend.utils.buffer(), \
+       xend.console.interface(0, dom0_port.local_port))
 
     ##
     ## MAIN LOOP
index e1ed295ed39ff55806817f81e27d032a170c9e22..2baddcd6161524ebcb70fc8013006c7d510adebd 100644 (file)
@@ -56,5 +56,16 @@ static void blkif_ctrlif_rx(ctrl_msg_t *msg, unsigned long id)
 
 void blkif_ctrlif_init(void)
 {
+    ctrl_msg_t                       cmsg;
+    blkif_be_driver_status_changed_t st;
+
     (void)ctrl_if_register_receiver(CMSG_BLKIF_BE, blkif_ctrlif_rx);
+
+    /* Send a driver-UP notification to the domain controller. */
+    cmsg.type      = CMSG_BLKIF_BE;
+    cmsg.subtype   = CMSG_BLKIF_BE_DRIVER_STATUS_CHANGED;
+    cmsg.length    = sizeof(blkif_be_driver_status_changed_t);
+    st.status      = BLKIF_DRIVER_STATUS_UP;
+    memcpy(cmsg.msg, &st, sizeof(st));
+    ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE);
 }
index b0c524f3906f988a63c6b2a32ac201a1ec47d09e..2936d78ea2c5decddee3d7e97ec8fab737c89de0 100644 (file)
@@ -670,7 +670,19 @@ static void blkif_ctrlif_rx(ctrl_msg_t *msg, unsigned long id)
 
 int __init xlblk_init(void)
 {
+    ctrl_msg_t                       cmsg;
+    blkif_fe_driver_status_changed_t st;
+
     (void)ctrl_if_register_receiver(CMSG_BLKIF_FE, blkif_ctrlif_rx);
+
+    /* Send a driver-UP notification to the domain controller. */
+    cmsg.type      = CMSG_BLKIF_FE;
+    cmsg.subtype   = CMSG_BLKIF_FE_DRIVER_STATUS_CHANGED;
+    cmsg.length    = sizeof(blkif_fe_driver_status_changed_t);
+    st.status      = BLKIF_DRIVER_STATUS_UP;
+    memcpy(cmsg.msg, &st, sizeof(st));
+    ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE);
+
     return 0;
 }